package com.itheima.springboottlias.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.springframework.stereotype.Component;

/**
 * @author iTaotao
 * @date 2023/7/19 10:39
 * @desciption: 时间
 */
//@Aspect
@Component
@Slf4j
public class TimeAspect {
    @Around("execution(* com.itheima.springboottlias.controller.*.*(..))")
    public Object recordTime(ProceedingJoinPoint joinPoint) throws Throwable{
        long start = System.currentTimeMillis();
        Object proceed = joinPoint.proceed();
        long end = System.currentTimeMillis();
        log.info("执行时间: {} ms",end - start);
        return proceed;

    }
}

